import CaseEntity, { Case } from '../entity/CaseEntiy';

export interface HandleStatistics {
    caseId: string;
    requestNum: string;
    name: string;
    gender: string;
    contact_1: string;
    contact_2: string;
    callTime: string;
    sourceType: string;
    eventTime: string;
    isUrgent: string;
    isSecret: string;
    location: string;
    content: string;
    purpose: string;
    keyword: string;
    requestType: string;
    category: string;
    feedbackType: string;
}

export interface CaseFlowItem {
    curStep: string;
    department: string;
    name: string;
    method: string;
    propose: string;
    takeOverDep: string;
    receiver: string;
    receiveTime: string;
    handleTime: string;
    duringTime: string;
}

export interface OvertimeDataType {
    content: string;
    caseId: string;
    caseState: string;
    overtimeState: number[];
    lastHandleTime: string;
}

export interface OvertimeType {
    total: number;
    row: OvertimeDataType[];
}

export default class CaseApi {
    fetchCaseList(): Array<Case> {
        const caseArray: Array<Case> = [];
        for (let i: number = 0; i < 20; i++) {
            let theCase = new CaseEntity({
                content: '江宁区，家门口有个电线杆，已经倾斜，有广电线路在上面',
                uuid: 'DH1801243735',
                date: '2018/01/22 14:58:10',
            });
            caseArray.push(theCase);
        }
        return caseArray;
    }
    fetchHandleStatistics(): HandleStatistics {
        return require('../assets/json/HandleStatistics');
    }
    fetchCaseFlow(): CaseFlowItem[] {
        return require('../assets/json/CaseFlow');
    }
    fetchHandleInfo() {
        return require('../assets/json/CaseHandleInfo');
    }
    fetchOverTimeList(): OvertimeType {
        return require('../assets/json/overtimeTotal');
    }
    fetchUnsatisfyDetails() {
        return require('../assets/json/unsatisfy');
    }
    fetchUnsatisfyList() {
        const caseArray: Array<Case> = [];
        for (let i: number = 0; i < 290; i++) {
            let theCase = new CaseEntity({
                content: '江宁区，家门口有个电线杆，已经倾斜，有广电线路在上面',
                uuid: 'DH1801243735',
                date: '2018/01/22 14:58:10',
                unsatisfyClass: Math.floor(Math.random() * 9)
            });
            caseArray.push(theCase);
        }
        return caseArray;
    }
    fetchFeedbackTable() {
        return require('../assets/json/feedbackInfo.json');
    }
    fetchKPIRank() {
        return require('../assets/json/KPIRank.json');
    }
    fetchKPIPreview() {
        return require('../assets/json/KPIPreview.json');
    }
    fetchBasicKPI() {
        return require('../assets/json/basicKPI.json');
    }
    fetchExtraKPI() {
        return require('../assets/json/extraKPI.json');
    }
    fetchHotEventDataList() {
        return require('../assets/json/hotEventTableData.json');
    }
    fetchHotEventDetails() {
        return require('../assets/json/hotEventDetails.json');
    }
    fetchHotTopTenList() {
        return require('../assets/json/hotTopTenList.json');
    }
    fetchMapCaseList() {
        return require('../assets/json/mapCaseList.json');
    }
    
}